Conversation
Encrypt StorageHelper values with an AES-GCM envelope backed by AndroidKeyStore keys in production. Migrate legacy plaintext entries on read, drop undecryptable values, and use a Robolectric-safe JVM cipher so storage tests still exercise encrypted persistence semantics.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughA new Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What changed
StorageHelpervalues before writing them to disk while keepingSharedPreferencesas the persistence backendStorageCipherabstraction with Android Keystore-backed AES/GCM encryption in productionWhy
Local SDK values were being stored as plaintext strings. The right fix was to harden the single storage seam rather than layering ad hoc protection at call sites.
Impact
Root cause
StorageHelperpersisted sensitive values directly throughSharedPreferences, so any persisted storage entry was written in plaintext.Validation
./gradlew :source:api:testDebugUnitTest --tests 'com.clerk.api.storage.StorageHelperTest' --tests 'com.clerk.api.signout.SignOutServiceTest' --tests 'com.clerk.api.sdk.ClerkDeviceTokenUpdateTest' --tests 'com.clerk.api.magiclink.PersistentPendingNativeMagicLinkStoreTest' --tests 'com.clerk.api.network.middleware.outgoing.VersioningUserAgentMiddlewareTest' :source:api:spotlessCheck :source:api:detekt